<extend name="Public/base"/>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>接口配置</h2>
    </div>
	
	<div class="tab-wrap">
    <div class="tab-content">
    <!-- 表单 -->
    <form id="form" action="{:U('save')}" method="post" class="form-horizontal">
        
        <h3>IOS更新检查配置</h3>

        <div class="form-item">
            <label class="item-label">新版本号<span class="check-tips"><notempty name="ios_version">（{$result.ios_version.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="ios_version" value="{$result.ios_version.value}">

			</div>
        </div>
        <div class="form-item">
            <label class="item-label">更新内容：<span class="check-tips"><notempty name="result.ios_change_log.desc">（{$result.ios_change_log.desc}）</notempty></span> </label>
			<div >		
				<textarea class=" input-large" name="ios_change_log" rows='5' >{$result.ios_change_log.value}</textarea>

			</div>
        </div>
        
        <div class="form-item">        
            <label class="item-label">更新地址：<span class="check-tips"><notempty name="result.ios_update_link.desc">（{$result.ios_update_link.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="ios_update_link" value="{$result.ios_update_link.value}">

			</div>
        </div>
     
        <div class="form-item">        
            <label class="item-label">需要强制更新的版本号：<span class="check-tips"><notempty name="result.ios_force_update.desc">（{$result.ios_force_update.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="ios_force_update" value="{$result.ios_force_update.value}" placeholder="(多个用,隔开)">
				<!-- <label class="textarea input-large">
					<textarea name="config[{$config.name}]">{$config.value}</textarea>
				</label> -->
			</div>
        </div>

        <div class="form-item">        
            <label class="item-label">城市列表数据库版本：<span class="check-tips"><notempty name="result.ios_city_version.desc">（{$result.ios_city_version.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="ios_city_version" value="{$result.ios_city_version.value}">

			</div>
        </div>

        <div class="form-item">
            <label class="item-label">IOS第三方登陆开关：<span class="check-tips"><notempty name="result.ios_third_login.desc">（{$result.ios_third_login.desc}）</notempty></span> </label>
			<div class="radio">		
                            <input type="radio" value="1" name="ios_third_login" <eq name="result.ios_third_login.value" value="1">checked="checked"</eq>>开
                            <input type="radio" value="0" name="ios_third_login" <eq name="result.ios_third_login.value" value="0">checked="checked"</eq>>关
			</div>
        </div>
        <div class="form-item">
            <label class="item-label">IOS应用检查更新开关：<span class="check-tips"><notempty name="result.ios_check_version.desc">（{$result.ios_check_version.desc}）</notempty></span> </label>
			<div class="radio">		
                            <input type="radio" value="1" name="ios_check_version" <eq name="result.ios_check_version.value" value="1">checked="checked"</eq>>开
                            <input type="radio" value="0" name="ios_check_version" <eq name="result.ios_check_version.value" value="0">checked="checked"</eq>>关
			</div>
        </div>
        <div class="form-item">
                <label class="item-label">IOS自动填充内容开关：</label>
			<div class="controls">		
                            <button class="btn submit-btn ajax-post-itunes"  type="button"  url="{:U('getItunes')}">填充</button>
                            <button class="btn submit-btn " id='reset' type="button">重置</button>
			</div>
        </div>
        <br/><br/><br/><br/>
        <h3>Android更新检查配置</h3>
        <div class="form-item">
            <label class="item-label">新版本号<span class="check-tips"><notempty name="result.android_version.desc">（{$result.android_version.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="android_version" value="{$result.android_version.value}">

			</div>
        </div>
        <div class="form-item">
            <label class="item-label">版本标识<span class="check-tips"><notempty name="result.android_version_flag.desc">（{$result.android_version_flag.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="android_version_flag" value="{$result.android_version_flag.value}">

			</div>
        </div>
        <div class="form-item">
            <label class="item-label">更新内容：<span class="check-tips"><notempty name="result.android_change_log.desc">（{$result.android_change_log.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="android_change_log" value="{$result.android_change_log.value}">

			</div>
        </div>
        
        <div class="form-item">        
            <label class="item-label">更新地址：<span class="check-tips"><notempty name="result.android_update_link.desc">（{$result.android_update_link.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="android_update_link" value="{$result.android_update_link.value}">

			</div>
        </div>
     
        <div class="form-item">        
            <label class="item-label">需要强制更新的版本标识：<span class="check-tips"><notempty name="result.android_force_update.desc">（{$result.android_force_update.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="android_force_update" value="{$result.android_force_update.value}" placeholder="(多个用,隔开)">
				<!-- <label class="textarea input-large">
					<textarea name="config[{$config.name}]">{$config.value}</textarea>
				</label> -->
			</div>
        </div>

        <div class="form-item">        
            <label class="item-label">城市列表数据库版本：<span class="check-tips"><notempty name="result.android_city_version.desc">（{$result.android_city_version.desc}）</notempty></span> </label>
			<div class="controls">		
				<input type="text" class="text input-large" name="android_city_version" value="{$result.android_city_version.value}">

			</div>
        </div>


        <div class="form-item cf">
            <button class="btn submit-btn ajax-post hidden" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <a class="btn btn-return" href="javascript:;">返 回</a>
        </div>
    </form>
    </div>
    </div>

</block>

<block name="script">
<script type="text/javascript">
$(function(){
    var rlog;
    $('.ajax-post-itunes').click(function(){
        var target = $(this).attr('url');
        $.get(target).success(function(data){
                    var version = data.version;
                    var releaseNotes = data.releaseNotes;
                    rlog = $("textarea[name='ios_change_log']").val();
                    $("input[name='ios_version']").val(version);
                    $("textarea[name='ios_change_log']").val(releaseNotes);

            });
    });
    $('#reset').click(function(){
        var org_version = "<?php echo $result['iso_version']['value'] ?>";
        var org_description = rlog;
        $("input[name='iso_version']").val(org_version);
        $("textarea[name='ios_change_log']").val(org_description);
    });    

    
});
</script>
</block>
